package cn.itsource.org.pojo.domain;

import cn.itsource.basic.domain.BaseTreeNode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

@Data //生成get  set  hashcode equals toString方法
@AllArgsConstructor// 全参数构造
@NoArgsConstructor // 无参数构造
@Table(name="t_department") //指向表名
@ApiModel(description = "部门对象类")
public class Department extends BaseTreeNode<Department> {

    //部门编号
    @ApiModelProperty(value = "部门编号",example = "007")
    /**
     * @NotBlank：这个字段非空
     */
    @Size(min = 3,max = 6,message = "部门编号请输入3-6位")
    private String sn;//
    //名称
    /**
     * @NotBlank：这个字段非空
     */
    @NotBlank(message = "部门名称不能为空")
    @ApiModelProperty(value = "部门名称")
    private String name;
    //状态 1：正常 0:禁用  //Integer默认值 null  int默认值 0 int是多少位的？32位
    @ApiModelProperty(value = "状态 1：正常 0:禁用")
    private Integer state;
    //部门经理id
    @Column(name = "manager_id")
    private Long managerId;
    //上级部门id
    @Column(name = "parent_id")
    private Long parentId;
    //先不管
    @Column(name = "dir_path")
    private String dirPath;

    @Transient //临时的，不会参与单表curd
    private String managerName;
    @Transient //临时的，不会参与单表curd
    private String parentName;

    /**
     * 上级部门结构数据
     */
    @Transient
    private Long[] parentIds;
}
